<?php
include "../config/connection.inc";
function getMajors(){
    $query = "select * from MAJORS";
    return mysql_query($query);
}

function getMajorsById($id){
    $query = "select * from MAJORS where MAJOR_ID = $id";
    return mysql_fetch_array(mysql_query($query));
}

function insertmajors($major){
    $query = "INSERT INTO MAJORS".
              " VALUES (NULL, '".$major['title']."','".$major['descript']."')";
    $result = mysql_query($query);
    return $result;
}

function deleteMajor($id){
    $query = "delete from MAJORS where MAJOR_ID = $id";
    $result = mysql_query($query);
    return $result;
}

function editMajor($major){
    $query = "update MAJORS set 
            MAJOR_TITLE = '".$major['title']."',
            MAJOR_DESCRIPTION = '".$major['descript']."'
             where MAJOR_ID = '".$major['id']."'";
    $result = mysql_query($query);
    return $result;
}
?>